package cn.bone.chapter07;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/*
    -Xms600m
    -Xmx600m
 */
public class OOMTest {

    public static void main(String[] args){

        System.out.println("hello");

        List<Picture> list = new ArrayList<>();
        while(true){
            try{
                Thread.sleep(30);

                Random random = new Random();
                int i = random.nextInt(1024 * 1024);
                list.add(new Picture(i));
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}

class Picture{
    private byte[] bytes;
    public Picture(int length){
        bytes = new byte[length];
    }
}
